﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


namespace BloomsburyBanHang.DTO
{
    public class ChiTietDonDatHangDTO
    {
        public int MaDDH;



        public int MaTaiLieu;



        public int SoLuong;



        public double DonGia;
        

        public static ChiTietDonDatHangDTO Convert(CHI_TIET_HOA_DON cthd)
        {
            ChiTietDonDatHangDTO ctddh = new ChiTietDonDatHangDTO();
            ctddh.DonGia = cthd.GiaLucMua;
            ctddh.SoLuong = cthd.SoLuong;
            ctddh.MaDDH = cthd.MaChiTietHoaDon;
            ctddh.MaTaiLieu = cthd.MaSanPham;
            return ctddh;
        }
        public static List<ChiTietDonDatHangDTO> ListConvert(List<CHI_TIET_HOA_DON> lst)
        {
            List<ChiTietDonDatHangDTO> result = new List<ChiTietDonDatHangDTO>();
            for (int i = 0; i < lst.Count; i++)
            {
                result.Add(Convert(lst[i]));
            }
            return result;
        }
        public static CHI_TIET_HOA_DON ReverseConvert(ChiTietDonDatHangDTO ctddh)
        {
            CHI_TIET_HOA_DON cthd = new CHI_TIET_HOA_DON();
            cthd.GiaLucMua = ctddh.DonGia;
            cthd.SoLuong = ctddh.SoLuong;
            cthd.MaChiTietHoaDon = ctddh.MaDDH;
            cthd.MaSanPham = ctddh.MaTaiLieu;
            return cthd;
        }
        public static List<CHI_TIET_HOA_DON> ReverseListConvert(List<ChiTietDonDatHangDTO> lst)
        {
            List<CHI_TIET_HOA_DON> result = new List<CHI_TIET_HOA_DON>();
            for (int i = 0; i < lst.Count; i++)
            {
                result.Add(ReverseConvert(lst[i]));
            }
            return result;
        }




    }

}